<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common-app/taglibs.jsp"%>

<!DOCTYPE html>
<html>
<head>
<title>申请书编辑</title>
<script type="text/javascript" src="${res}/js/jquery/jquery.form.js"></script>
<script type="text/javascript"
	src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript"
	src="${res}/js/validate/irisvalidator.js"></script>
<script type="text/javascript"
	src="${res}/js/keyword/keywordtips.js"></script>
<script type="text/javascript"
	src="${res_app}/js/app/proposal/irisPrpPrepare.js"></script>
	
<script type="text/javascript">var ctx="${ctx}";var res="${res}";var res_hn="${res_app}"; </script>
<script type="text/javascript">
$(function(){
	queryflex();
});
var ctxpath = "${ctx}";
var prcWin = new progressWin("${res}");//初始化遮罩层

/**
 * 页面初始化方法 所有的都定义在里面
 */
$(function() {
	queryflex();
	
	$("#wbox1,#wbox2").click(function() {
		check("check");
	});
	updatePdfNotes();
	window.setInterval("checkPdfStatus()", "10000");//检验申请书的pdf
	
	initControl();
	
	fileInit("prpContent_upload","JPG,DOC,WPS,DOCX,PDF,XLS,XLSX,TIFF",null,
	"{'jpg':'10250','pdf':'20490','DOC':'10250','WPS':'10250','DOCX':'10250','XLS':'10250','XLSX':'10250','TIFF':'10250'}");
	//fileInitAttachSingle("prp_attachs", "JPG,PDF", null, 20, "{'JPG':'3072','PDF':'3072'}");
	$("#prpContent_upload").find(".file").hide();//隐藏文本框
	
	fileInit("feaReport_upload","DOC,DOCX,WPS");

	
	
	$("table.t_css").each(function(){
		$(this).find("tr:even").addClass("li_1");
		$(this).find("tr:odd").addClass("li_2");
	});
	
	initAttach("1,2");  //初始化附件
	
});

/**
 * 申报日期默认为当前日期
 */
$(document).ready(function() {
	var myDate = new Date();  
	var year=myDate.getFullYear();
	var month=myDate.getMonth()+1;
	var date=myDate.getDate(); 
	var nowDate=year+"-"+month+"-"+date;
	/*
    if($("#submit_date").val()==""){
	   $("#submit_date").val(nowDate);
    }*/
    //initControl("prpInfo");
    //initControl("attentInfo");
    //初始化所有的
    initControl();
});

/**
 * 填写检查
 */
function check(type){
	 setTotalAmt();
	 validate($("#basicInfo"),"基本信息");
	validate($("#orgInfo"),"单位信息");
	 irisJqValEmpty($("#business"),"单位信息->近三年营业情况请完整填写");

	 checkAttach(0,'1','营业执照、组织机构代码等','');
	//区分事业单位和企业单位
	var nature_value = $('#attach_nature_value').val();
	if(nature_value !=null){
		nature_value=nature_value.substring(0,1);
		if(nature_value=='A'){
			checkAttach(1,'2','税务部门开具的单位上年度及本年度至申报月期间的国、地税完税证明','12');
		}
	}
	checkAttach(2,'2','上一年度经审计的财务审计报告或通过审查的事业单位财务决算报表','12');
	checkAttach(3,'0','项目可行性研究报告','');
	checkAttach(4,'0','有资质的审计机构提供的企业实际投资额审计报告',''); 
	
	 if($('#prp_status').val()=='10')
	    checkDupAttach("prpContent_upload"); 
	if(!valResult()){
		irisValShowMsg($("#wbox1"));
		return false;
	}
	if(type=="check"){
		showBox($("#wbox1"), "300px", "200px", "检查通过","1:所有检查全部合格");
	}
	return true; 
}


function setTotalAmt(){
	$('#request_amt').val($("#total_funds").val());
	
}
function ContentDownDesc(template)
{
	window.open('${res_app}/guide/'+encodeURIComponent(template),'','resizable=yes,height=700,width=1000,scrollbars=yes,status=yes')
	return false;
}
</script>
<style>
	textarea{overflow-y:   auto;
			overflow-x:hidden;
			}
	.thclass {
    background-color: #EDF2F8;
    border-bottom: 0px solid #A1C0DC;
    color: #003366;
    font-weight: bold;
    height: 30px;
}
</style>
</head>
<body>

	<c:set var="xmlstr" value="${xmlData}" />
	<x:parse xml="${xmlstr}" var="xmlData" />
	<input type="hidden" id="childDiv" class="thickbox"/>
	<input type="hidden" id="filePath" value="${ctx}/file/ajax-filedownload?fileCode=" />
	<input type="hidden" id="menuId" value="${param.menuId}" />

	<div id="showMessage"></div>
	<div id="content">
		<cpt:helpTips key="prpedit" id="prpEditTips"></cpt:helpTips>
		
		<div class="clear_h15"></div>
		<div class="word_box" id="mainDiv">
			<div class="bar_btn">
				<span class="left"> 
					<c:set var="grantCode"><x:out select="$xmlData/data/proposal/grant_code" /></c:set>
					<input name="Submit" type="button" class="button_01" value="保存" onclick="saveAction()" /> 
					&nbsp; <c:if test="${not empty fbl.pdfViewUrl}"><input name="Submit" type="button" class="button_01" value="下载PDF"  onclick="genPdfAction()"/></c:if>
					<security:authorize ifNotGranted="A_DAILU_PROPOSAL">
					&nbsp; <input name="Submit" type="button" class="button_01"	value="提交给单位管理员" onclick="submitAction()" />
					</security:authorize>
					<security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
					&nbsp; <input name="Submit" type="button" class="button_01"	value="提交到区主管部门" onclick="submitAction()" />
					</security:authorize> 
					&nbsp; <input name="Submit" type="button" class="button_01" value="返回" onclick="backToList()" />
				</span>
				<span class="right"> 
					<input title="填写检查" class="btn_inspect" type="button" id="wbox1"/>
				</span>
				<span class="right">
				<c:set var="template">无锡市农业发展专项资金申报操作规程.doc</c:set>
				<input name="Submit" type="button" class="button_01" value="操作规程" onclick="return ContentDownDesc('${template}');" />&nbsp;&nbsp;
				</span>
			</div>
			<div class="bar_b">
				<input type="hidden" id="pdfStatus" value="${pdfStatus}" />
				<span class="right">版本号：<span name="proposal/prp_version" id="prp_version"><x:out select="$xmlData/data/proposal/prp_version" /></span></span>
			</div>
			<form method="post" id="mainForm">
				<input type="hidden" value="${grantCode}" id="grantCode"
					name="grantCode"> 
				<input type="hidden" value="${posCode}" id="posCode" name="posCode"> 
				<input type="hidden" value="${xmlData}" id="xmlData" name="xmlData">
			</form>
				<div class="word_title">
					<c:set var="statYear" scope="request">${statYear}</c:set>
					<c:if test="${empty statYear}">
						<c:set var="statYear" scope="request"><x:out select="$xmlData/data/proposal/stat_year" /></c:set>
					</c:if>
					<input type="hidden" name="proposal/stat_year" value="${statYear}">
					<span name="proposal/grant_name" ><x:out select="$xmlData/data/proposal/grant_name" /></span>-项目申请书 (<span name="proposal/stat_year">${statYear}</span>年)<br />						
					<input type="hidden" name="proposal/sub_grant_name" value="<x:out select="$xmlData/data/proposal/sub_grant_name" />" />
					<input type="hidden" id="prp_status" name="proposal/status" value="<x:out select="$xmlData/data/proposal/status" />">
					<input type="hidden" name="proposal/grant_code" value="<x:out select="$xmlData/data/proposal/grant_code" />" />  <input type="hidden" name="proposal/psn_code" value="<x:out select="$xmlData/data/proposal/psn_code" />" />
					<input type="hidden" id="grant_no" name="proposal/grant_no" value="<x:out select="$xmlData/data/proposal/grant_no" />" />							
					<input type="hidden" name="proposal/sub_grant_code" value="<x:out select="$xmlData/data/proposal/sub_grant_code" />" />
					<input type="hidden" id="sub_grant_no" name="proposal/sub_grant_no" value="<x:out select="$xmlData/data/proposal/sub_grant_no" />" />
					<input type="hidden" name="proposal/help_grant_code" value="<x:out select="$xmlData/data/proposal/help_grant_code" />" />
					<input type="hidden" id="help_grant_no" name="proposal/help_grant_no" value="<x:out select="$xmlData/data/proposal/help_grant_no" />" />
					
					<input type="hidden" id="sysDate" value="${sercverSysDate}" />
					<c:set var="formCode"><x:out select="$xmlData/data/proposal/form_code" /></c:set>
					<c:if test="${empty formCode}"><c:set var="formCode" value="${param.formCode}"></c:set></c:if>
					<input type="hidden" name="proposal/form_code" value="${formCode}" />
					<input type="hidden" name="proposal/request_amt" 
							id="request_amt" value="<x:out select="$xmlData/data/proposal/request_amt"/>">
				 <!-- 公用的配置界面 -->
				    <jsp:include page="./prpeditmain_public.jsp"><jsp:param value="${xmlstr}" name="xmlstr" /></jsp:include>
				</div>
				<div id="tabnav">
					<ul>
						<li class="down" id="tab1" onclick="changeTab(this.id)"><a href="###"><span>基本信息${res}</span>
						</a>
						</li>
						<li id="tab2" onclick="changeTab(this.id)" ><a href="###"><span>单位信息</span>
						</a>
						</li>
						<li id="tab3" onclick="changeTab(this.id)" ><a href="###"><span>附件清单</span>
						</a>
						</li>
						<li id="tab4" onclick="changeTab(this.id)" ><a href="###"><span>报告正文</span>
						</a>
						</li>
					</ul>
				</div>
				
				<!-- 基本信息   -->
				<div class="tab_box" id="fragment-tab1">
					<jsp:include page="../info/prpInfoEdit_nyfz.jsp">
						<jsp:param value="${xmlstr}" name="xmlstr" />
					</jsp:include>
				</div>
				
				<!-- 单位信息  -->
				<div class="tab_box" id="fragment-tab2" style="display: none">
					<jsp:include page="../org/prporg_nyfz.jsp">
						<jsp:param value="${xmlstr}" name="xmlstr" />
					</jsp:include>
				</div>
				
				<!-- 附件列表   -->
				<div class="tab_box" id="fragment-tab3" style="display: none">
					<jsp:include page="../attach/prpAttachEdit_nyfz.jsp">
						<jsp:param value="${xmlstr}" name="xmlstr" />
					</jsp:include>
				</div>
				<div class="tab_box" id="fragment-tab4" style="display: none">
			       <jsp:include page="../content/prpContentEdit_zdzx.jsp">
				       <jsp:param value="${xmlstr}" name="xmlstr" />
				   <jsp:param value="progress" name="type" />
			    </jsp:include>
		</div>
		</div>
				 
			<div class="bar_btn02">
				<span class="left"> 
					<input name="Submit" type="button" class="button_01" value="保存" onclick="saveAction()" /> 
					&nbsp; <c:if test="${not empty fbl.pdfViewUrl}"><input name="Submit" type="button" class="button_01" value="下载PDF"  onclick="genPdfAction()"/></c:if>
					<security:authorize ifNotGranted="A_DAILU_PROPOSAL">
					&nbsp; <input name="Submit" type="button" class="button_01"	value="提交给单位管理员" onclick="submitAction()" />
					</security:authorize>
					<security:authorize ifAnyGranted="A_DAILU_PROPOSAL">
					&nbsp; <input name="Submit" type="button" class="button_01"	value="提交到区主管部门" onclick="submitAction()" />
					</security:authorize> 
					&nbsp; <input name="Submit" type="button" class="button_01" value="返回" onclick="backToList()" /> 
				</span>
				<span class="right"> 
					<input title="填写检查" class="btn_inspect" type="button" id="wbox2"/>
				</span>
				<span class="right">
				<c:set var="template">无锡市农业发展专项资金申报操作规程.doc</c:set>
				<input name="Submit" type="button" class="button_01" value="操作规程" onclick="return ContentDownDesc('${template}');" />&nbsp;&nbsp;
				</span>
				<!-- 
				<span class="right">
				    <input name="Submit" type="button" class="button_01" value="查看填写说明" onclick="return ContentDownDesc('${template}');" />&nbsp;&nbsp;
				</span>
				 -->
			</div>
		</div>
		<div class="clear_h15"></div>
	</div>
</body>

</html>